<template>
  <div class="dv-loading" v-if="loading">
    <span style="--i: 1">l</span>
    <span style="--i: 2">o</span>
    <span style="--i: 3">a</span>
    <span style="--i: 4">d</span>
    <span style="--i: 5">i</span>
    <span style="--i: 6">n</span>
    <span style="--i: 7">g</span>
    <span style="--i: 8">.</span>
    <span style="--i: 9">.</span>
    <span style="--i: 10">.</span>
  </div>
</template>

<script lang="ts" setup name="DvLoding">
import { ref } from 'vue';
const loading = ref<boolean>(false)
const show = ()=> {
    loading.value = true;
}
const hide = ()=> {
    loading.value = false;
}
defineExpose({
  loading,
  show,
  hide,
});
</script>

<style lang="less" scoped>
.dv-loading {
  position: fixed;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  -webkit-box-reflect: below 0px -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.2));

  span {
    position: relative;
    display: inline-block;
    color: @primary-color;
    font-size: 36px;
    line-height: 40px;
    text-transform: uppercase;
    letter-spacing: 8px;
    animation: wavyAnimate 1s ease-in-out infinite;
    animation-delay: calc(0.1s * var(--i));
    user-select: none;
  }

  @keyframes wavyAnimate {
    0% {
      transform: translateY(0);
    }
    20% {
      transform: translateY(-20px);
    }
    40%,
    100% {
      transform: translateY(0);
    }
  }
}
</style>
